<?php
class RemoverRelatorioDAO implements BaseDAO {
	
	/* Remove o relatorio do usuario */
	public function removerRelatorio($id) {
		$utility = QueryUtility::getInstance();
		
		try {
			$query = $utility->getQuery(QueryConstants::REMOVER_RELATORIO,$id);
			$conexao = new Conexao();	
			$result = $conexao->executar($query);
			
			$status = $this->mapearResultados($result);
		} catch (Exception $exc) {
			throw $exc;
		}
		
		return $status;		
	}
	
	/* Mapeia os resultados */
	function mapearResultados($result) {
		if (pg_affected_rows($result) == 0) {
			$msg = sprintf(MensagensConstants::FALHA_NA_IMPORTACAO_REMOCAO, "remover");
			throw new Exception(msg);
		} else {
			return true;
		}
	}
	
}
?>